package kr.hkit.powerjava.chapter08.work;
class Point {
	private int x;
	private int y;
	
	public Point(int a, int b)
	{
		this.x = a;
		this.y = b;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	@Override
	public String toString() {
		return "Point [x=" + x + ", y=" + y + "]";
	}
	
	
}
public class Circle {
	public final static double PI = 3.14;
	private Point cx;
	private Point cy;
	private double r;
	
	public Circle(Point cx, Point cy) {
		this.cx = cx;
		this.cy = cy;
		this.setR(this.cx, this.cy);
		this.r = this.getR();
	}
	
	public double area()
	{
		double area = PI * this.r * this.r;
		return area;
	}
	//좌표를 이용하여 반지름 길이 구함.
	//(cy값이 cx보다 더큰경우 가능한 공식 반대의 경우는 추후에...)
	public void setR(Point cx, Point cy) { 
		this.r = java.lang.Math.sqrt(((cy.getX() - cx.getX())*(cy.getX() - cx.getX()) 
									+ (cy.getY() - cx.getY())*(cy.getY() - cx.getY())));	
	}
	
	public double getR()
	{
		return this.r;
	}

	@Override
	public String toString() {
		return "Circle [반지름 값 = " + r + 
				", 원의 넓이는 = "+ area() + "]";
	}

}
